Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adds billing service #85

Merged
merged 12 commits into from May 2, 2017
Merged

adds billing service #85

merged 12 commits into from May 2, 2017

Conversation

conradkleinespel
Copy link
Contributor

@conradkleinespel conradkleinespel commented Apr 26, 2017

Adds service that can be used to created a bill for a given contract and month.

BillingService.new.create_bill(Contract.all.first, Date.new(2017, 5))
BillingService.new.generate_bills_pdf(Contract.first.client, Date.new(2017, 5))

Todo:

  • generate bill for a given month and contract
  • save bill to database
  • different bill line titles for additional requests vs measure tokens
  • unique (bill_month, contract) db constraint
  • generate pdf with all bills for a client for a given month
  • PDF: UTF8 support (for French language and € symbol)
  • PDF: I18n
  • PDF: add client and startup information (address, siret, etc)

@conradkleinespel conradkleinespel force-pushed the rails--feature--billing branch 4 times, most recently from abb39d9 to 637c050 Compare Apr 26, 2017
@@ -19,4 +19,9 @@ def already_exist?
return false
end

# TODO: anything special planned here?
def is_unique?
Copy link
Contributor Author

@conradkleinespel conradkleinespel Apr 26, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure what was supposed to happen here, but this method was referenced in the model, so I needed to stub it for things not to break during tests

Copy link
Member

@jgigault jgigault Apr 27, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is_unique? should not be used, it does not exist any more

Copy link
Contributor Author

@conradkleinespel conradkleinespel Apr 27, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, I've removed it, thanks ! 👍

@conradkleinespel conradkleinespel force-pushed the rails--feature--billing branch 2 times, most recently from 7a04509 to 5a8831c Compare Apr 27, 2017
@conradkleinespel
Copy link
Contributor Author

@conradkleinespel conradkleinespel commented Apr 27, 2017

I used expected_start_date and expected_end_date because start_date and end_date are both nil on my machine, even though the contract is in production phase. I'm not sure what to do here. Any clue?

@jgigault
Copy link
Member

@jgigault jgigault commented Apr 27, 2017

@conradkleinespel start_date and end_date are not implemented, and you can use expected_start_date and expected_end_date for now

@conradkleinespel conradkleinespel force-pushed the rails--feature--billing branch 2 times, most recently from 7cc5aa0 to 7b5cae2 Compare Apr 28, 2017
@conradkleinespel
Copy link
Contributor Author

@conradkleinespel conradkleinespel commented Apr 28, 2017

@jgigault I just pushed the last changes for the first version of the BillingService. It currently does the following things:

  • creates bills from measurement data (a Bill is composed of BillLines and have a description and a price)
  • creates PDFs that shows all of the bills that a client must pay for a given month

Let me know what you think 😃

@conradkleinespel
Copy link
Contributor Author

@conradkleinespel conradkleinespel commented Apr 28, 2017

@jgigault One more thing, the PDF is currently saved to /tmp/bill.pdf. This probably is not suitable for production. Where would you like the PDF to go ? AWS S3 ? Send via email ? Something else ?

@jgigault jgigault force-pushed the rails--feature--billing branch from b77d293 to 0a69e00 Compare May 1, 2017
@jgigault jgigault changed the title [WIP] adds billing service adds billing service May 2, 2017
@jgigault jgigault merged commit 6bbf914 into rails May 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants